package cn.schoolwow.quickdao.module.database.dml.json.flow.insert.common;

import cn.schoolwow.quickdao.module.database.parent.flow.executor.ExecuteUpdateConnectionFlow;
import cn.schoolwow.quickflow.domain.FlowContext;
import cn.schoolwow.quickflow.flow.BusinessFlow;
import com.alibaba.fastjson.JSONObject;

public class ExecuteInsertJSONObjectFlow implements BusinessFlow {
    @Override
    public void executeBusinessFlow(FlowContext flowContext) throws Exception {
        flowContext.startFlow(new ExecuteUpdateConnectionFlow())
                .putTemporaryData("name", "插入JSONObject")
                .execute();

        JSONObject instance = (JSONObject) flowContext.checkData("instance");
        instance.put("generateKeys", flowContext.getData("generateKeys"));
    }

    @Override
    public String name() {
        return "执行插入JSONObject语句";
    }

}
